package cn.zlq;

import java.math.BigDecimal;

/**
 * @ClassName AverageCapitalPlusInterest
 * @Description TODO
 * @Author 郑万富
 * @Date 2020/11/23 10:56
 * @Version 1.0
 */
public class AverageCapitalPlusInterest extends Capital {
    int monthNum;
    BigDecimal havePayed = new BigDecimal("0");
    BigDecimal monthRate = yearRate.divide(new BigDecimal("12"));
    @Override
    public BigDecimal calculate() {
        for(int i=1;i<=totalMonth;i++){
            monthTotalPayment = loanMoney.multiply(yearRate)
                    .multiply(new BigDecimal(Math.pow(yearRate.add(new BigDecimal("1")).doubleValue(),totalMonth)))
                    .divide(new BigDecimal(Math.pow(yearRate.add(new BigDecimal("1")).doubleValue(),totalMonth-1)));
        }
        return null;
    }
}
